﻿@{
    Layout = null;
}

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8" />
    <title>客户账户管理 - 广软智慧书城</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- 样式保持不变 -->
    <link rel="stylesheet" href="~/conjs/global.css" />
    <link rel="stylesheet" href="~/conjs/Site.css" />
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">

    <!-- Vue & Axios CDN -->
    <script src="https://unpkg.com/vue@3"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <style>
        :root {
            --primary-color: #2c3e50;
            --secondary-color: #ecf0f1;
            --accent-color: #e74c3c;
            --text-color: #34495e;
        }

        body {
            font-family: 'Segoe UI', system-ui, sans-serif;
            background: #f8f9fa;
        }

        /* 页眉样式 */
        #header {
            background: var(--primary-color);
            padding: 1rem 2rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
        }

        #logotxt {
            color: white;
            font-size: 1.8rem;
            font-weight: 600;
        }

        /* 导航样式 */
        .nav {
            background-color: #34495e;
            padding: 10px 0;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }

            .nav ul {
                list-style: none;
                padding: 0;
                margin: 0;
                display: flex;
                justify-content: center;
                flex-wrap: wrap;
                gap: 20px;
            }

            .nav li a {
                color: white;
                text-decoration: none;
                padding: 5px 10px;
                border-radius: 4px;
                transition: all 0.3s ease;
                font-size: 14px;
            }

                .nav li a:hover {
                    background-color: rgba(255,255,255,0.1);
                    text-decoration: underline;
                }

        .container {
            width: 95%;
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 15px;
        }

        .head {
            background-color: lightskyblue;
            border-radius: 20px;
            text-decoration: none;
            font-size: 0.9rem;
            transition: all 0.3s ease;
            align-items: center;
        }
        /* 主要内容 */
        #content {
            padding: 2rem;
            width: 80%;
            margin: 0 auto;
            height: 100vh;
            position: relative;
            width: 100%;
            min-height: 100%;
            padding-bottom: 100px;
            box-sizing: border-box;
        }

        .dashboard-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 2rem;
        }

        .dashboard-title {
            color: var(--primary-color);
            font-size: 1.8rem;
        }

        /* 表格样式 */
        .table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

            .table th,
            .table td {
                padding: 1rem;
                text-align: left;
                border-bottom: 1px solid #ddd;
            }

            .table th {
                background-color: var(--secondary-color);
                color: var(--text-color);
            }

            .table tr:hover {
                background-color: #f5f5f5;
            }

        .action-btn {
            padding: 0.5rem 1rem;
            border-radius: 20px;
            text-decoration: none;
            font-size: 0.9rem;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
        }

        .edit-btn {
            background: #3498db;
            color: white;
        }

        .detail-btn {
            background: #9b59b6;
            color: white;
        }

        /* 页脚 */
        #footer {
            background: var(--primary-color);
            color: white;
            text-align: center;
            padding: 1.5rem;
            margin-top: 3rem;
            width: 100%;
            height: 100px;
            /* footer的高度一定要是固定值*/
            position: relative;
            bottom: 0px;
        }
    </style>
</head>
<body>
    <div id="app">
        <!-- 页眉 -->
        <div id="header">
            <div id="logo"><span id="logotxt">广软智慧书城</span></div>
            <div id="loginmsg">
                <a href="/ShopInfo/Index" class="action-btn" style="background: var(--accent-color);">退出</a>
            </div>
        </div>

        <!-- 导航菜单 -->
        <nav class="nav">
            <div class="container">
                <ul>
                    <li><a href="/OrderInfo/Index">订单设置</a></li>
                    <li class="head"><a href="/CapitalAdvanc/Index">客户账户设置</a></li>
                    <li><a href="/BookDetailsInfo/GetBookList">书籍设置</a></li>
                    <li><a href="/ShopInfo/GetShopList">客户设置</a></li>
                    <li><a href="/AdministrationInfo/GetAdmin">管理员设置</a></li>
                </ul>
            </div>
        </nav>

        <!-- 内容区 -->
        <div id="content">
            <div class="dashboard-header">
                <h1 class="dashboard-title"><i class="fas fa-user-edit"></i> 客户账户管理</h1>
            </div>

            <div class="account">
                <table class="table">
                    <thead>
                        <tr>
                            <th>客户编号</th>
                            <th>余额</th>
                            <th>累积充值金额</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr v-for="item in items" :key="item.id">
                            <td>{{ item.shopId }}</td>
                            <td>{{ item.balance }}</td>
                            <td>{{ item.reChargeAmount }}</td>
                            <td>
                                <a :href="'/CapitalAdvanc/Edit?id=' + item.id" class="action-btn edit-btn">修改</a> |
                                <a :href="'/CapitalAdvanc/Details?id=' + item.id" class="action-btn detail-btn">详情</a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <!-- 页脚 -->
        <div id="footer">
            <hr style="margin:20px 0px;" />
            网上书城后台管理系统 - MVC架构 © {{ currentYear }}
        </div>
    </div>

    <script>
        const { createApp } = Vue;

        createApp({
            data() {
                return {
                    items: [],
                    currentYear: new Date().getFullYear()
                };
            },
            mounted() {
                axios.get('/CapitalAdvanc/GetList') // 确保后端提供此 JSON 接口
                    .then(response => {
                        this.items = response.data;
                    })
                    .catch(error => {
                        console.error("加载数据失败：", error);
                    });
            }
        }).mount('#app');
    </script>
</body>
</html>
